Skip to content

fix(levoit): send speed command when leaving a preset at unchanged level - #53

Open
Bleialf wants to merge 1 commit into
tuct:mainfrom
Bleialf:fix/fan-speed-leaving-preset
Open

fix(levoit): send speed command when leaving a preset at unchanged level#53
Bleialf wants to merge 1 commit into
tuct:mainfrom
Bleialf:fix/fan-speed-leaving-preset

Conversation

@Bleialf

@Bleialf Bleialf commented Aug 7, 2026

Copy link
Copy Markdown

Setting the same fan level while Sleep/Auto is active was skipped by the speed
guard, so no UART command was sent and the device stayed in the preset. Treat a
speed call that leaves a non-Manual preset as a change.

Repro (Core 300S): Manual @ 100% → Sleep → set 100% again → nothing happens.

Cause: in Sleep/Auto the MCU reports no fan level, so apply_device_status()
gets speed_level == -1 and this->speed stays stale. The next
set_percentage(100) looks like "no change" and is skipped.

Tested on a Core 300S: Sleep and Auto both fixed.

Setting the same fan level while Sleep/Auto is active was skipped by the
speed guard, so no UART command was sent and the device stayed in the
preset. Treat a speed call that leaves a non-Manual preset as a change.
Copilot AI lite review requested due to automatic review settings August 7, 2026 15:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a logic gap in the Levoit fan control path where setting the same speed while a non-Manual preset (e.g., Sleep/Auto) is active could be treated as “no change,” preventing the UART command from being sent and leaving the device stuck in the preset mode.

Changes:

  • Treat a speed call as a “change” when it implicitly leaves a non-Manual preset, even if the numeric speed level is unchanged.
  • Add clarifying inline comments documenting why speed can appear unchanged while the operating mode should still transition to Manual.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants